package net.ibizsys.eclipse.studio.vc.svn;

import java.util.HashMap;
import java.util.Map;

import org.tigris.subversion.javahl.NotifyAction;
import org.tigris.subversion.javahl.NotifyStatus;

/**
 * SVN通知类型
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public class SVNNotifyAction
{
	private static Map<Integer, String> actionMap = new HashMap<Integer, String>();
	private static Map<Integer, String> stateMap = new HashMap<Integer, String>();

	static
	{
		actionMap.put(NotifyAction.update_add, "[更新][添加]");
		actionMap.put(NotifyAction.update_completed, "[更新][完成]");
		actionMap.put(NotifyAction.update_delete, "[更新][删除]");
		actionMap.put(NotifyAction.update_external, "[更新][外部]");
		actionMap.put(NotifyAction.update_replaced, "[更新][替换]");
		actionMap.put(NotifyAction.update_update, "[更新][更新]");

		actionMap.put(NotifyAction.commit_added, "[提交][添加]");
		actionMap.put(NotifyAction.commit_deleted, "[提交][删除]");
		actionMap.put(NotifyAction.commit_modified, "[提交][修改]");
		actionMap.put(NotifyAction.commit_postfix_txdelta, "[提交]");
		actionMap.put(NotifyAction.commit_replaced, "[提交][替换]");

		stateMap.put(NotifyStatus.inapplicable, "不可用");
		stateMap.put(NotifyStatus.unknown, "未知");
		stateMap.put(NotifyStatus.unchanged, "无变化");
		stateMap.put(NotifyStatus.missing, "错过");
		stateMap.put(NotifyStatus.obstructed, "阻塞");
		stateMap.put(NotifyStatus.changed, "修改");
		stateMap.put(NotifyStatus.merged, "合并");
		stateMap.put(NotifyStatus.conflicted, "冲突");

	}

	public static String GetActionText(int action)
	{
		if (actionMap.containsKey(action))
		{
			return actionMap.get(action);
		}
		return "未知";
	}

	public static String GetStateText(int action)
	{
		if (stateMap.containsKey(action))
		{
			return stateMap.get(action);
		}
		return "未知操作";
	}
}
